home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
159_01
/
advent.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-03
|
14KB
|
463 lines
/* ADVENT.H revised header for BDS c vers 1.43 */
/* Revised for Eco-C88 V2.72 by Bob Withers
Defined all variables for driver routines and
altered header to declare them external for
all sub-modules. BW - 09/14/85
*/
#define NUL '\0'
#define MAXDIM(a) (sizeof(a) / sizeof(a[0]))
#define VOID void
#define NEAR near
#define PASCAL pascal
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
typedef short SHORT;
typedef unsigned short USHORT;
typedef long LONG;
typedef unsigned long ULONG;
typedef short BOOL;
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define MAXLOC 150
#define MAXOBJ 100
#define WORDSIZE 20
#define DWARFMAX 7
#define MAXDIE 3
#define MAXTRS 79
#define READ_BIN "rb"
#define WRITE_BIN "wb"
#define VOCAB_OBJECT 1000
#define VOCAB_VERB 2000
#define VOCAB_MSG 3000
/*
Object definitions
*/
#define KEYS 1
#define LAMP 2
#define GRATE 3
#define CAGE 4
#define ROD 5
#define ROD2 6
#define STEPS 7
#define BIRD 8
#define DOOR 9
#define PILLOW 10
#define SNAKE 11
#define FISSURE 12
#define TABLET 13
#define CLAM 14
#define OYSTER 15
#define MAGAZINE 16
#define DWARF 17
#define KNIFE 18
#define FOOD 19
#define BOTTLE 20
#define WATER 21
#define OIL 22
#define MIRROR 23
#define PLANT 24
#define PLANT2 25
#define STALACTITE 26
#define FIGURE 27
#define AXE 28
#define DRAWING 29
#define PIRATE 30
#define DRAGON 31
#define CHASM 32
#define TROLL 33
#define TROLL2 34
#define BEAR 35
#define MESSAGE 36
#define VOLCANO 37
#define VEND 38
#define BATTERIES 39
#define CARPET 40
#define NUGGET 50
#define DIAMONDS 51
#define SILVER 52
#define JEWELS 53
#define COINS 54
#define CHEST 55
#define EGGS 56
#define TRIDENT 57
#define VASE 58
#define EMERALD 59
#define PYRAMID 60
#define PEARL 61
#define RUG 62
#define SPICES 63
#define CHAIN 64
/*
Verb definitions
*/
#define NULLX 21
#define BACK 8
#define LOOK 57
#define CAVE 67
#define ENTRANCE 64
#define DEPRESSION 63
/*
Action verb definitions
*/
#define TAKE 1
#define DROP 2
#define SAY 3
#define OPEN 4
#define NOTHING 5
#define LOCK 6
#define ON 7
#define OFF 8
#define WAVE 9
#define CALM 10
#define WALK 11
#define KILL 12
#define POUR 13
#define EAT 14
#define DRINK 15
#define RUB 16
#define THROW 17
#define QUIT 18
#define FIND 19
#define INVENTORY 20
#define FEED 21
#define FILL 22
#define BLAST 23
#define SCORE 24
#define FOO 25
#define BRIEF 26
#define READ 27
#define BREAK 28
#define WAKE 29
#define SUSPEND 30
#define HOURS 31
#define LOG 32
#define SAVE 33
#define RESTORE 34
#define VERBOSE 35
/*
Bits of array cond
indicating location status
*/
#define LIGHT 1
#define WATOIL 2
#define LIQUID 4
#define NOPIRAT 8
#define HINTC 16
#define HINTB 32
#define HINTS 64
#define HINTM 128
#define HINT 240
/*
Adventure global variables
*/
struct S_VocabTab
{
char *pWord;
SHORT sWord;
};
typedef struct S_VocabTab VOCABTAB;
struct trav
{
SHORT tdest;
SHORT tverb;
SHORT tcond;
};
typedef struct trav TRAV;
struct travtab
{
TRAV *pTrav; // trav array for location
SHORT sTrav; // # entries for location
};
typedef struct travtab TRAVTAB;
#ifdef DRIVER
#define CLASS
#define INIT(x) = x
#else
#define CLASS extern
#define INIT(x)
#endif
#define NEARDATA NEAR
CLASS SHORT brief_sw;
/*
Database variables
*/
CLASS TRAV * NEARDATA pTravel; /* travel array & count for */
CLASS SHORT NEARDATA sTravCnt; /* the current location */
CLASS SHORT NEARDATA actmsg[32] /* action messages */
#ifdef DRIVER
= {
0, 24, 29, 0, 33, 0, 33, 38, 38, 42, /* 0 - 9 */
14, 43, 110, 29, 110, 73, 75, 29, 13, 59, /* 10 - 19 */
59, 174, 109, 67, 13, 147, 155, 195, 146, 110, /* 20 - 29 */
13, 13 /* 30 - 31 */
};
#else
;
#endif
/*
English variables
*/
CLASS SHORT NEARDATA verb;
CLASS SHORT NEARDATA object;
CLASS SHORT NEARDATA motion;
CLASS char NEARDATA word1[WORDSIZE];
CLASS char NEARDATA word2[WORDSIZE];
/*
Play variables
*/
CLASS SHORT NEARDATA turns INIT(0);
CLASS SHORT NEARDATA loc INIT(1);
CLASS SHORT NEARDATA oldloc INIT(1);
CLASS SHORT NEARDATA oldloc2 INIT(1);
CLASS SHORT NEARDATA newloc INIT(3);
CLASS SHORT NEARDATA cond[MAXLOC] /* location status */
#ifdef DRIVER
= {
0, 5, 1, 5, 5, 1, 1, 5, 17, 1, /* 0 - 9 */
1, 0, 0, 32, 0, 0, 2, 0, 0, 64, /* 10 - 19 */
2, 2, 2, 0, 6, 0, 2, 0, 0, 0, /* 20 - 29 */
0, 2, 2, 0, 0, 0, 0, 0, 4, 0, /* 30 - 39 */
2, 0, 128, 128, 128, 128, 136, 136, 136, 128, /* 40 - 49 */
128, 128, 128, 136, 128, 136, 0, 8, 0, 2, /* 50 - 59 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, /* 70 - 79 */
128, 128, 136, 0, 0, 8, 136, 128, 0, 2, /* 80 - 89 */
2, 0, 0, 0, 0, 4, 0, 0, 0, 0, /* 90 - 99 */
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */
0, 0, 0, 4, 0, 1, 1, 0, 0, 0, /* 110 - 119 */
0, 0, 8, 8, 8, 8, 8, 8, 8, 8, /* 120 - 129 */
8, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 130 - 139 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140 - 149 */
};
#else
;
#endif
CLASS SHORT NEARDATA place[MAXOBJ] /* object location */
#ifdef DRIVER
= {
0, 3, 3, 8, 10, 11, 0, 14, 13, 94, /* 0 - 9 */
96, 19, 17, 101, 103, 0, 106, 0, 0, 3, /* 10 - 19 */
3, 0, 0, 109, 25, 23, 111, 35, 0, 97, /* 20 - 29 */
0, 119, 117, 117, 0, 130, 0, 126, 140, 0, /* 30 - 39 */
96, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 49 */
18, 27, 28, 29, 30, 0, 92, 95, 97, 100, /* 50 - 59 */
101, 0, 119, 127, 130, 0, 0, 0, 0, 0, /* 60 - 69 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */
};
#else
;
#endif
CLASS SHORT NEARDATA fixed[MAXOBJ] /* second object loc */
#ifdef DRIVER
= {
0, 0, 0, 9, 0, 0, 0, 15, 0, -1, /* 0 - 9 */
0, -1, 27, -1, 0, 0, 0, -1, 0, 0, /* 10 - 19 */
0, 0, 0, -1, -1, 67, -1, 110, 0, -1, /* 20 - 29 */
-1, 121, 122, 122, 0, -1, -1, -1, -1, 0, /* 30 - 39 */
-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 49 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50 - 59 */
0, 0, 121, 0, -1, 0, 0, 0, 0, 0, /* 60 - 69 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */
};
#else
;
#endif
CLASS SHORT NEARDATA visited[MAXLOC]; /* >0 i